package com.example.dataservice.mapper;

import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.example.api.model.RechargeRecord;

public interface RechargeRecordMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(RechargeRecord record);

    int insertSelective(RechargeRecord record);

    RechargeRecord selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(RechargeRecord record);

    int updateByPrimaryKey(RechargeRecord record);


    @Select("""
            select * 
            from b_recharge_record 
            where recharge_no = #{orderId}
            for update
            """)
    /*通过充值订单号查询充值记录*/
    RechargeRecord selectByRechargeNO(String orderId);

    @Update("""
            update b_recharge_record
            set recharge_status = #{rechargeStatus}
            where recharge_no = #{rechargeNo}
            """)
    /*通过订单号更新充值的状态*/
    int updateStatusByNO(RechargeRecord record);
}